<?php
		//连接数据库
		$con = mysqli_connect('localhost','root','www');
		mysqli_set_charset($con,'utf8');
		mysqli_select_db($con,'admin');
		$SQL = "select * from config";
		$result = mysqli_query($con,$SQL);
		
		$arr = mysqli_fetch_assoc($result);
	
		if($arr['status'] == 0){
			echo "<h1>网站正在维护中</h1>";
			exit;
		}
?>
<!DOCTYPE html>
<html>
	<meta charset="utf-8" />
	<title><?php echo $arr['title']; ?></title>
	<link href="../public/home/css/qingkongsuoyougeshi.css" rel="stylesheet" style="text/css" />
	<link href="../public/home/css/css7.css" rel="stylesheet" style="text/css" />
<body>
	<div id="top">
		<div id="top1">
			<div>
				<div>
					<div id="top1a">
						<a href=" ">设为首页</a>
						<a href=" ">收藏LAMP兄弟连</a>
						<a href=" ">帮助</a>
						<a href=" ">推广链接</a>
						<a href=" ">社区应用</a>
						<a href=" ">最新帖子</a>
						<a href=" ">精华区</a>
						<a href=" ">社区服务</a>
						<a href=" ">会员列表</a>
						<a href=" ">统计排行</a>
						<a href=" ">搜索</a>
					</div>
				</div>
			</div>
		</div>
		<div id="top2">
			<div>
				<div>
					<div id="img">
						<img src="../public/home/img/<?php echo $arr['logo']; ?>" />
					</div>
					<?php
						if(!isset($_GET['id'])){
							$uid = '';
					?>
					
					<div id="denglu">
						<form method="post" action="doLogin.php">
							<input type="text" name="userName" />
							<input type="password" name="password" />
							<input type="checkbox" name="checkbox" value="jizhu" />
							<span>记住密码</span>
							<a href="./updatePassword.php">找回密码</a>
							<input type="submit" value="登录" />
							<a href='./reg.php'><button type="button" id='zhuce'>注册</button></a>
						</form>
					</div>
					<?php
						}else{
							$uid = $_GET['id'];
						//session_start();
						
						//		用id 查出头像图片
						$con = mysqli_connect('localhost','root','www');
						mysqli_set_charset($con,'utf8');
						mysqli_select_db($con,'admin');
						$SQL2 = "select * from userDetail where id={$_GET['id']}";
						$result2 = mysqli_query($con,$SQL2);
						$arr2 = mysqli_fetch_assoc($result2);
						//var_dump($arr2);
						
						
						//  	查出user表中用户的权限
						$con = mysqli_connect('localhost','root','www');
						mysqli_set_charset($con,'utf8');
						mysqli_select_db($con,'admin');
						$SQL3 = "select * from user where id={$_GET['id']}";
						$result3 = mysqli_query($con,$SQL3);
						$arr3 = mysqli_fetch_assoc($result3);
						$auths = array('普通用户','管理员');
						
					?>	
						<div id='php'>
							<div id='php1'>
								<div><p>会员名：<?php echo $arr2['name']; ?>.</p></div>
								<div><p>[<?php echo $auths[$arr3['auth']] ?>]</p></div>
								<div><p>[积分:50]</p></div>
							</div>
							<div id='php2'>
								<div><img src="../public/home/tmp_name/<?php echo $arr2['photo']; ?>" /></div>
							</div>
							<div id='php3'>
								<a href='./updateNames.php?id=<?php echo $_GET['id']; ?>'>更改个人信息</a>
								<a href='./updateHeadPhoto.php?id=<?php echo $_GET['id']; ?>'>更改头像</a>
							</div>
							<div id='php4'>
								<a href='./out.php'>退出</a>
							</div>
							<div style='clear:both'></div>
						</div>
							
					<?php
						}
					
					?>
					
					
				</div>
			</div>
		</div>
		<div id="top3">
			<div>
				<div>
					<a href="">技术交流</a>
					<a href="">兄弟连</a>
					<a href="">连队趣事</a>
					<a href="">议事厅</a>
				</div>
			</div>
		</div>
	</div>
	
	<div id="zhongxia">
		<div id="zhong">
			<div>
				<img src="../public/home/img/20150710055301.jpg" />
			
				<img src="../public/home/img/lampt_1_20140529.jpg" />
			
				<img src="../public/home/img/lampt_2_201405291.png" />
			
				<img src="../public/home/img/lampt_3.png.jpg " / >
			
				<img src="../public/home/img/lampt_4.png.jpg" />
			</div>
			<div style="clear:both"></div>
		</div>
		
		<?php
			/* $con = mysqli_connect('localhost','root','www');
			mysqli_set_charset($con,'utf8');
			mysqli_select_db($con,'admin'); */
			
			$SQL4 = "select * from type where pid = '0'";
			$result4 = mysqli_query($con,$SQL4);
			while($arr4 = mysqli_fetch_assoc($result4)){
			
			
		?>
		
		
		<div class="types">
			<div>:::.<?php echo $arr4['name']; ?>.:::</div>
			<div>
				<?php
					$SQL5 = "select * from type where pid={$arr4['id']}";
					$result5 = mysqli_query($con,$SQL5);
					while($arr5 = mysqli_fetch_assoc($result5)){
				?>
			
			
				<div class="type">
					<img src="../public/admin/images/main/<?php echo $arr5['img']; ?>" />
					<div>
						<a href="./postList.php?tid=<?php echo $arr5['id']; ?>&id=<?php echo $uid; ?>"><?php echo $arr5['name']; ?></a>
						<div>
							<span>帖子 91136</span>
							<span>主题 10598</span>
							<span>最后发帖:2015-08-21 22:22</span>
						</div>
					</div>
				</div>
				
				<?php
					}
					
				?>
				<div style="clear:left"></div>
			</div>
		
		</div>
		
		<?php
			}
		
		?>
		
		<div class="types">
			<div>友情链接</div>
			<div id="xiabu">
			
			<?php
			
			$SQL2 = "select * from friend";
			$result2 = mysqli_query($con,$SQL2);
	
			while($array = mysqli_fetch_assoc($result2)){
		
		?>
			
				<a href="<?php echo $array['url']; ?>"><img src="../admin/config/<?php echo $array['logo']; ?>" title='<?php echo $array['description']; ?>' /></a>
				
		<?php
			}
			//关闭
			mysqli_close($con);
			?>
			
			</div>
		</div>
		
		
		
		<div id="dibu">
					<div id="alianjie">
						<a href=" ">联系我们</a>
						<span>|</sapn>
						<a href=" ">无图版</a>
						<span>|</span>
						<a href=" ">手机浏览</a>
						<span>|</span>
						<a href=" ">清除COOKIES</a>
					</div>
					<div id="dibuwenzi">
						<p>Powered by phpwind v8.7 Certificate Copytight Time now is:08-22 08:45</p>
					</div>
					<div id="gongbeihao">
						<p>©<?php echo $arr['copyright']; ?> Gzip disabled 京ICP备11018177号 Total 0.040525(s) query 3,京公网安备11011302000117</p>
					</div>
		</div>
		
		
		
		
		
		
	</div>


</body>
</html>